/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
import * as $protobuf from "protobufjs/minimal.js";
import Long from 'long';
$protobuf.default.util.Long = Long;
$protobuf.default.configure();

const $Reader = $protobuf.default.Reader, $Writer = $protobuf.default.Writer, $util = $protobuf.default.util;

const $root = {};

export const Game = $root.Game = (() => {

    const Game = {};

    Game.p_key_value_name = (function() {

        function p_key_value_name(p) {
            if (p)
                for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
                    if (p[ks[i]] != null)
                        this[ks[i]] = p[ks[i]];
        }

        p_key_value_name.prototype.k = 0;
        p_key_value_name.prototype.v = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
        p_key_value_name.prototype.name = "";

        p_key_value_name.create = function create(properties) {
            return new p_key_value_name(properties);
        };

        p_key_value_name.encode = function encode(m, w) {
            if (!w)
                w = $Writer.create();
            if (m.k != null && Object.hasOwnProperty.call(m, "k"))
                w.uint32(8).int32(m.k);
            if (m.v != null && Object.hasOwnProperty.call(m, "v"))
                w.uint32(16).int64(m.v);
            if (m.name != null && Object.hasOwnProperty.call(m, "name"))
                w.uint32(26).string(m.name);
            return w;
        };

        p_key_value_name.decode = function decode(r, l) {
            if (!(r instanceof $Reader))
                r = $Reader.create(r);
            var c = l === undefined ? r.len : r.pos + l, m = new $root.Game.p_key_value_name();
            while (r.pos < c) {
                var t = r.uint32();
                switch (t >>> 3) {
                case 1:
                    m.k = r.int32();
                    break;
                case 2:
                    m.v = r.int64();
                    break;
                case 3:
                    m.name = r.string();
                    break;
                default:
                    r.skipType(t & 7);
                    break;
                }
            }
            return m;
        };

        p_key_value_name.fromObject = function fromObject(d) {
            if (d instanceof $root.Game.p_key_value_name)
                return d;
            var m = new $root.Game.p_key_value_name();
            if (d.k != null) {
                m.k = d.k | 0;
            }
            if (d.v != null) {
                if ($util.Long)
                    (m.v = $util.Long.fromValue(d.v)).unsigned = false;
                else if (typeof d.v === "string")
                    m.v = parseInt(d.v, 10);
                else if (typeof d.v === "number")
                    m.v = d.v;
                else if (typeof d.v === "object")
                    m.v = new $util.LongBits(d.v.low >>> 0, d.v.high >>> 0).toNumber();
            }
            if (d.name != null) {
                m.name = String(d.name);
            }
            return m;
        };

        p_key_value_name.toObject = function toObject(m, o) {
            if (!o)
                o = {};
            var d = {};
            if (o.defaults) {
                d.k = 0;
                if ($util.Long) {
                    var n = new $util.Long(0, 0, false);
                    d.v = o.longs === String ? n.toString() : o.longs === Number ? n.toNumber() : n;
                } else
                    d.v = o.longs === String ? "0" : 0;
                d.name = "";
            }
            if (m.k != null && m.hasOwnProperty("k")) {
                d.k = m.k;
            }
            if (m.v != null && m.hasOwnProperty("v")) {
                if (typeof m.v === "number")
                    d.v = o.longs === String ? String(m.v) : m.v;
                else
                    d.v = o.longs === String ? $util.Long.prototype.toString.call(m.v) : o.longs === Number ? new $util.LongBits(m.v.low >>> 0, m.v.high >>> 0).toNumber() : m.v;
            }
            if (m.name != null && m.hasOwnProperty("name")) {
                d.name = m.name;
            }
            return d;
        };

        p_key_value_name.prototype.toJSON = function toJSON() {
            return this.constructor.toObject(this, $protobuf.default.util.toJSONOptions);
        };

        return p_key_value_name;
    })();

    return Game;
})();

export { $root as default };
